package com.cxl.autocode.data;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.summer.core.dao.impl.BaseDaoImpl;

public class SessionHibernateFactory<T extends BaseDaoImpl> {
	
	SessionFactory sessionFactory;
	
	T dao=null;
	
	public void setFactory(SessionFactory sessionFactory)
	{
		dao.setSessionFactory(sessionFactory);
	}
	
	public SessionFactory getFactory()
	{
		BeanFactory beanFactory=new ClassPathXmlApplicationContext("/applicationContext.xml");
		SessionFactory sessionFactory=(SessionFactory)beanFactory.getBean("sessionFactory");
		return sessionFactory;
	}

}
